const screenConfig = {
  code: 'screen',
  type: 'screen',
  label: '大屏设置',
  icon: '',
  options: {
    setup: [
      {
        type: 'el-input-number',
        label: '大屏宽度',
        name: 'width',
        required: true,
        placeholder: 'px',
      },
      {
        type: 'el-input-number',
        label: '大屏高度',
        name: 'height',
        required: true,
        placeholder: 'px',
      },
      {
        type: 'el-input-textarea',
        label: '大屏简介',
        name: 'description',
        required: false,
        placeholder: '',
      },
      {
        type: 'vue-color',
        label: '背景颜色',
        name: 'backgroundColor',
        required: false,
        placeholder: '#000000',
      },
      {
        type: 'el-upload-picture',
        label: '背景图片',
        name: 'backgroundImage',
        required: false,
        placeholder: '#000000',
      },
    ],
    data: [],
    position: [],
  },
}

const widgetTools = [
  // type=html类型的组件
  {
    code: 'widget-text',
    type: 'html',
    label: '文本',
    icon: 'text',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '文本内容',
          name: 'text',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体大小',
          name: 'fontSize',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体颜色',
          name: 'color',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体间距',
          name: 'letterSpacing',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体背景',
          name: 'background',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '文字粗细',
          name: 'fontWeight',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '对齐方式',
          name: 'textAlign',
          required: false,
          placeholder: '',
        },
      ],

      // 数据
      data: [],

      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-marquee',
    type: 'html',
    label: '滚动文本',
    icon: 'marquee',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '文本内容',
          name: 'text',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体大小',
          name: 'fontSize',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体颜色',
          name: 'color',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体间距',
          name: 'letterSpacing',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体背景',
          name: 'background',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '文字粗细',
          name: 'fontWeight',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '对齐方式',
          name: 'textAlign',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '开启滚动',
          name: 'marqueeSet',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '滚动速度',
          name: 'marqueeQuit',
          required: false,
          placeholder: '',
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-href',
    type: 'html',
    label: '超链接',
    icon: 'href',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '文本内容',
          name: 'text',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体大小',
          name: 'fontSize',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体颜色',
          name: 'color',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体间距',
          name: 'letterSpacing',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体背景',
          name: 'background',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '文字粗细',
          name: 'fontWeight',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '对齐方式',
          name: 'textAlign',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-radio-group',
          label: '跳转方式',
          name: 'jumpMode',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '超链地址',
          name: 'linkAdress',
          required: false,
          placeholder: '',
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-time',
    type: 'html',
    label: '当前时间',
    icon: 'time',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-select',
          label: '时间格式',
          name: 'timeFormat',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '自定义格式',
          name: 'customFormat',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体间距',
          name: 'letterSpacing',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '字体大小',
          name: 'fontSize',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体颜色',
          name: 'color',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '字体背景',
          name: 'background',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '文字粗细',
          name: 'fontWeight',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '对齐方式',
          name: 'textAlign',
          required: false,
          placeholder: '',
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-image',
    type: 'html',
    label: '图片',
    icon: 'image',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '开启旋转',
          name: 'startRotate',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '旋转时间',
          name: 'startRotate',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-slider',
          label: '透明度',
          name: 'transparency',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '圆角',
          name: 'borderRadius',
          required: false,
          placeholder: '',
        },
        {
          type: 'vue-color',
          label: '背景颜色',
          name: 'background',
          required: false,
          placeholder: '',
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-slider',
    type: 'html',
    label: '轮播图片',
    icon: 'slider',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-select',
          label: '轮播方向',
          name: 'tabDirection',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-select',
          label: '选择器',
          name: 'tabSelector',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-number',
          label: '轮播时间',
          name: 'tabTime',
          required: false,
          placeholder: '',
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-video',
    type: 'html',
    label: '视频',
    icon: 'video',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '地址',
          name: 'videoAdress',
          required: false,
          placeholder: '',
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-table',
    type: 'html',
    label: '表格',
    icon: 'table',
  },
  {
    code: 'widget-iframe',
    type: 'html',
    label: '内联框架',
    icon: 'iframe',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-input-text',
          label: '地址',
          name: 'iframeAdress',
          required: false,
          placeholder: '',
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-universal',
    type: 'html',
    label: '全能组件',
    icon: 'univresal',
  },
  // type=chart类型的组件
  {
    code: 'widget-barchart',
    type: 'chart',
    label: '柱形图',
    icon: 'barChart',
    options: {
      // 配置
      setup: [
        {
          type: 'el-input-text',
          label: '图层名称',
          name: 'layerName',
          required: false,
          placeholder: '',
        },
        {
          type: 'el-switch',
          label: '隐藏图层',
          name: 'hideLayer',
          required: false,
          placeholder: '',
        },
      ],
      // 折叠面板
      collapse: [
        {
          name: '柱体设置',
          list: [
            {
              type: 'el-slider',
              label: '最大宽度',
              name: 'maxWidth',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-slider',
              label: '圆角',
              name: 'circula',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-slider',
              label: '最小高度',
              name: 'minHeight',
              required: false,
              placeholder: '',
            },
          ],
        },
        {
          name: '标题设置',
          list: [
            {
              type: 'el-switch',
              label: '标题',
              name: 'isNoTitle',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-input-text',
              label: '标题',
              name: 'titleText',
              required: false,
              placeholder: '',
            },
            {
              type: 'vue-color',
              label: '字体颜色',
              name: 'textColor',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-input-text',
              label: '字体粗细',
              name: 'textFontWeight',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-input-number',
              label: '字体大小',
              name: 'textFontSize',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-input-text',
              label: '字体位置',
              name: 'textAlign',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-input-text',
              label: '副标题',
              name: 'subText',
              required: false,
              placeholder: '',
            },
            {
              type: 'vue-color',
              label: '字体颜色',
              name: 'subTextColor',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-input-text',
              label: '字体粗细',
              name: 'subTextFontWeight',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-input-number',
              label: '字体大小',
              name: 'subTextFontSize',
              required: false,
              placeholder: '',
            },
          ],
        },
        {
          name: 'X轴设置',
          list: [
            {
              type: 'el-input-text',
              label: '名称',
              name: 'xName',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-switch',
              label: '显示',
              name: 'hideX',
              required: false,
              placeholder: '',
            },
            {
              type: 'el-switch',
              label: '显示网格线',
              name: 'hideXLine',
              required: false,
              placeholder: '',
            },
            {
              type: 'vue-color',
              label: '网格线颜色',
              name: 'lineColor',
              required: false,
              placeholder: '',
            },
          ],
        },
        {
          name: 'Y轴设置',
          list: [],
        },
        {
          name: '数值设定',
          list: [],
        },
        {
          name: '提示语设置',
          list: [],
        },
        {
          name: '坐标轴边距设置',
          list: [],
        },
        {
          name: '图例操作',
          list: [],
        },
        {
          name: '自定义配色',
          list: [],
        },
      ],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-linechart',
    type: 'chart',
    label: '折线图',
    icon: 'lineChart',
    options: {
      // 配置
      setup: [],
      // 折叠面板
      collapse: [{ name: 1 }],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-barlinechart',
    type: 'chart',
    label: '柱线图',
    icon: 'barLineChart',
    options: {
      // 配置
      setup: [],
      // 折叠面板
      collapse: [{ name: 1 }],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-piechart',
    type: 'chart',
    label: '饼图',
    icon: 'pieChart',
    options: {
      // 配置
      setup: [],
      // 折叠面板
      collapse: [{ name: 1 }],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-hollow-piechart',
    type: 'chart',
    label: '空心饼图',
    icon: 'hollowPieChart',
    options: {
      // 配置
      setup: [],
      // 折叠面板
      collapse: [{ name: 1 }],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-funnel',
    type: 'chart',
    label: '漏斗图',
    icon: 'funnel',
    options: {
      // 配置
      setup: [],
      // 折叠面板
      collapse: [{ name: 1 }],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-gauge',
    type: 'chart',
    label: '仪表盘',
    icon: 'speed',
    options: {
      // 配置
      setup: [],
      // 折叠面板
      collapse: [{ name: 1 }],
      // 数据
      data: [],
      // 坐标
      position: [
        {
          type: 'el-input-number',
          label: '左边距',
          name: 'left',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '上边距',
          name: 'top',
          required: true,
          placeholder: 'px',
        },
        {
          type: 'el-input-number',
          label: '宽度',
          name: 'width',
          required: true,
          placeholder: '该容器在1920px大屏中的宽度',
        },
        {
          type: 'el-input-number',
          label: '高度',
          name: 'height',
          required: true,
          placeholder: '该容器在1080px大屏中的高度',
        },
      ],
    },
  },
  {
    code: 'widget-china-map',
    type: 'chart',
    label: '中国地图',
    icon: 'chinaMapChart',
  },
]

const getToolByCode = function(code) {
  // 获取大屏底层设置属性
  if (code == 'screen') {
    return screenConfig
  }
  // 获取组件
  var item = widgetTools.find(function(item, index, arrs) {
    return item.code === code
  })
  return item
}

export { widgetTools, getToolByCode }
